Con log:"Init" from:"XClass".
Con rem:"Xclass should already be created by now and have following members:".
Con rem:"providers providedMethods".
Con rem:"and should implement methods findMethod: and initialize".

Repl methodIn: XClass.
prepare [
    Con rem:"Used instead of initialization, lazy".
    (providers isNull) ifTrue:[||
        providers <- Vector new.
        providedMethods <- Vector new.
     ]else:[|| self].
]

Repl methodIn: XClass.
mixin:m[
    self addProvider:m.
]
Repl methodIn: XClass.
addProvider:p [
    self prepare.
    providers add: p.
    self rebuild.
]

Repl methodIn: XClass.
rebuild[
    providedMethods clear.
    (Range from:0 to:(providers length)) do:[i:||
        provider <- providers at:i.
        provider doMethods:[method:||
             providedMethods add:method.
        ]
    ]
]

Repl methodIn: XClass.
info[
    x <- StringBuffer new.
    x append: (self toString).
    x append: " with mixins ".
    x append: (providers toString).
    x append: " pmethods: ".
    x append: (providedMethods toString).
    ^x toString.
]
